#ifndef PUDGE_META_DUNION_TEST_HPP
#define PUDGE_META_DUNION_TEST_HPP

#include <pudge/meta/dunion.hpp>

namespace pudge { namespace meta {

	struct dunion_test_0_
	{
		void operator()(double & d) const
		{
			d = 1.5;
		}
		void operator()(int & i) const
		{
			i = -5;
		}
		void operator()() const
		{
			dunion<int,double> v;

			v = 0.0;
			v(*this);

			// shouldn't access elements this way, just for the testing purposes
			if(v.t1 != 1.5) throw -1;	
			
			v = 1;
			v(*this);

			if(v.t0 != -5.0) throw -1;
		}
	} const dunion_test_0;

	void dunion_test()
	{
		dunion_test_0();
	}
}}

#endif